package net.dgg.dggcloud.service.jrcrm.entity.customer;

import net.dgg.dggcloud.core.util.DateUtil;
import net.dgg.dggcloud.core.util.StringUtils;
import net.dgg.dggcloud.service.entity.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @ClassName: AttrVehicle-客户车辆信息
 * @Description: 用于客户车辆信息维护
 * @Author: 周潮
 * @Date: 2017年11月03 14:28:28
 * @Version V1.0
 */
@Entity
@Table(name = "cus_attr_vehicle")
public class AttrVehicle extends BaseEntity {

    //数据库表名
    public static final String TABLE_NAME = "cus_attr_vehicle";

    /**
     * 客户id 
     */
    @Column(name = "customer_id")
    private Long customerId;

    /**
     * 车辆所有内容前台展示用
     */
    @Transient
    private String frontShow;

    /**
     * 支付方式 1全款，2按揭
     */
    @Column(name = "pay_type")
    private Integer payType;

    /**
     * 支付方式-前台展示用
     */
    @Transient
    private String payTypeShow;

    /**
     * 车辆品牌 
     */
    @Column(name = "vehicle_brand")
    private String vehicleBrand;

    /**
     * 车辆品牌-前台展示用
     */
    @Transient
    private String vehicleBrandShow;

    /**
     * 购车时间 
     */
    @Column(name = "buying_time")
    private Date buyingTime;

    /**
     * 购车时间-前台展示用
     */
    @Transient
    private String buyingTimeShow;

    /**
     * 裸车价 
     */
    @Column(name = "bare_car_price")
    private Double bareCarPrice;

    /**
     * 裸车价-前台展示用
     */
    @Transient
    private String bareCarPriceShow;

    /**
     * 公里数 
     */
    @Column(name = "kilometer")
    private Integer kilometer;

    /**
     * 公里数-前台展示用
     */
    @Transient
    private String kilometerShow;

    /**
     * 车辆类型 
     */
    @Column(name = "vehicle_type")
    private String vehicleType;

    /**
     * 车辆类型-前台展示用
     */
    @Transient
    private String vehicleTypeShow;

    /**
     * 是否被抵押 
     */
    @Column(name = "is_mortgage")
    private Integer isMortgage;

    /**
     * 是否被抵押-前台展示用
     */
    @Transient
    private String isMortgageShow;

    /**
     * 车辆地域 
     */
    @Column(name = "vehicle_area")
    private String vehicleArea;

    /**
     * 车辆地域-前台展示用
     */
    @Transient
    private String vehicleAreaShow;

    /**
     * 按揭方式 
     */
    @Column(name = "mortgage_way")
    private String mortgageWay;

    /**
     * 按揭方式 -前台展示用
     */
    @Transient
    private String mortgageWayShow;

    /**
     * 按揭金额 
     */
    @Column(name = "mortgage_amount")
    private Double mortgageAmount;

    /**
     * 按揭金额 -前台展示用
     */
    @Transient
    private String mortgageAmountShow;

    /**
     * 按揭开始时间 
     */
    @Column(name = "mortgage_time")
    private Date mortgageTime;

    /**
     * 按揭开始时间 -前台展示用
     */
    @Transient
    private String mortgageTimeShow;

    /**
     * 月供 
     */
    @Column(name = "month_pay")
    private Double monthPay;

    /**
     * 月供 -前台展示用
     */
    @Transient
    private String monthPayShow;

    /**
     * 按揭年限 
     */
    @Column(name = "mortgage_years")
    private Integer mortgageYears;

    /**
     * 按揭年限 -前台展示用
     */
    @Transient
    private String mortgageYearsShow;

    /**
     * 车辆保险 
     */
    @Column(name = "vehicle_insurance")
    private String vehicleInsurance;

    /**
     * 车辆保险 -前台展示用
     */
    @Transient
    private String vehicleInsuranceShow;

    /**
     * 保险公司 
     */
    @Column(name = "insurance_company")
    private String insuranceCompany;

    /**
     * 保险公司 -前台展示用
     */
    @Transient
    private String insuranceCompanyShow;

    /**
     * 保险金额 
     */
    @Column(name = "insurance_amount")
    private Double insuranceAmount;

    /**
     * 保险金额 -前台展示用
     */
    @Transient
    private String insuranceAmountShow;

    /**
     * 外部系统读取标志 预留扩展字段，每外部系统占用一位，如1001
     */
    @Column(name = "read_flag")
    private String readFlag;

    /**
     * 外部系统来源标志 预留扩展字段，每外部系统占用一位，如1001
     */
    @Column(name = "source_flag")
    private String sourceFlag;

    /**
     * 扩展字段1 
     */
    @Column(name = "ext1")
    private String ext1;

    /**
     * 扩展字段2 
     */
    @Column(name = "ext2")
    private String ext2;

    /**
     * 扩展字段3 
     */
    @Column(name = "ext3")
    private String ext3;

    /**
     * 扩展字段4 
     */
    @Column(name = "ext4")
    private String ext4;

    /**
     * 扩展字段5 
     */
    @Column(name = "ext5")
    private String ext5;

    /**
     * 扩展字段6 
     */
    @Column(name = "ext6")
    private String ext6;

    /**
     * 扩展字段7 
     */
    @Column(name = "ext7")
    private String ext7;

    /**
     * 扩展字段8 
     */
    @Column(name = "ext8")
    private String ext8;

    /**
     * 扩展字段9 
     */
    @Column(name = "ext9")
    private String ext9;

    /**
     * 扩展字段10 
     */
    @Column(name = "ext10")
    private String ext10;

    /**
     * 扩展字段11 
     */
    @Column(name = "ext11")
    private String ext11;

    /**
     * 扩展字段12 
     */
    @Column(name = "ext12")
    private String ext12;

    /**
     * 扩展字段13 
     */
    @Column(name = "ext13")
    private String ext13;

    /**
     * 扩展字段14 
     */
    @Column(name = "ext14")
    private String ext14;

    /**
     * 扩展字段15 
     */
    @Column(name = "ext15")
    private String ext15;

    /**
     * 外部系统读取标志 预留扩展字段，每外部系统占用一位，如1001
     * @return read_flag 外部系统读取标志 预留扩展字段，每外部系统占用一位，如1001
     */
    public String getReadFlag() {
        return readFlag;
    }

    /**
     * 外部系统读取标志 预留扩展字段，每外部系统占用一位，如1001
     * @param readFlag 外部系统读取标志 预留扩展字段，每外部系统占用一位，如1001
     */
    public void setReadFlag(String readFlag) {
        this.readFlag = readFlag == null ? null : readFlag.trim();
    }

    /**
     * 外部系统来源标志 预留扩展字段，每外部系统占用一位，如1001
     * @return source_flag 外部系统来源标志 预留扩展字段，每外部系统占用一位，如1001
     */
    public String getSourceFlag() {
        return sourceFlag;
    }

    /**
     * 外部系统来源标志 预留扩展字段，每外部系统占用一位，如1001
     * @param sourceFlag 外部系统来源标志 预留扩展字段，每外部系统占用一位，如1001
     */
    public void setSourceFlag(String sourceFlag) {
        this.sourceFlag = sourceFlag == null ? null : sourceFlag.trim();
    }

    /**
     * 客户id
     * @return customer_id 客户id
     */
    public Long getCustomerId() {
        return customerId;
    }

    /**
     * 客户id
     * @param customerId 客户id
     */
    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    /**
     * 支付方式 1全款，2按揭
     * @return pay_type 支付方式 1全款，2按揭
     */
    public Integer getPayType() {
        return payType;
    }

    /**
     * 支付方式 1全款，2按揭
     * @param payType 支付方式 1全款，2按揭
     */
    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    /**
     * 车辆品牌
     * @return vehicle_brand 车辆品牌
     */
    public String getVehicleBrand() {
        return vehicleBrand;
    }

    /**
     * 车辆品牌
     * @param vehicleBrand 车辆品牌
     */
    public void setVehicleBrand(String vehicleBrand) {
        this.vehicleBrand = vehicleBrand == null ? null : vehicleBrand.trim();
    }

    /**
     * 购车时间
     * @return buying_time 购车时间
     */
    public Date getBuyingTime() {
        return buyingTime;
    }

    /**
     * 购车时间
     * @param buyingTime 购车时间
     */
    public void setBuyingTime(Date buyingTime) {
        this.buyingTime = buyingTime;
    }

    /**
     * 裸车价
     * @return bare_car_price 裸车价
     */
    public Double getBareCarPrice() {
        return (null != bareCarPrice ? bareCarPrice/1000000 : null);
    }

    /**
     * 裸车价
     * @param bareCarPrice 裸车价
     */
    public void setBareCarPrice(Double bareCarPrice) {
        this.bareCarPrice = (null != bareCarPrice ? bareCarPrice*1000000 : null);
    }

    /**
     * 公里数
     * @return kilometer 公里数
     */
    public Integer getKilometer() {
        return kilometer;
    }

    /**
     * 公里数
     * @param kilometer 公里数
     */
    public void setKilometer(Integer kilometer) {
        this.kilometer = kilometer;
    }

    /**
     * 车辆类型
     * @return vehicle_type 车辆类型
     */
    public String getVehicleType() {
        return vehicleType;
    }

    /**
     * 车辆类型
     * @param vehicleType 车辆类型
     */
    public void setVehicleType(String vehicleType) {
        this.vehicleType = vehicleType == null ? null : vehicleType.trim();
    }

    /**
     * 是否被抵押
     * @return is_mortgage 是否被抵押
     */
    public Integer getIsMortgage() {
        return isMortgage;
    }

    /**
     * 是否被抵押
     * @param isMortgage 是否被抵押
     */
    public void setIsMortgage(Integer isMortgage) {
        this.isMortgage = isMortgage;
    }

    /**
     * 车辆地域
     * @return vehicle_area 车辆地域
     */
    public String getVehicleArea() {
        return vehicleArea;
    }

    /**
     * 车辆地域
     * @param vehicleArea 车辆地域
     */
    public void setVehicleArea(String vehicleArea) {
        this.vehicleArea = vehicleArea == null ? null : vehicleArea.trim();
    }

    /**
     * 按揭方式
     * @return mortgage_way 按揭方式
     */
    public String getMortgageWay() {
        return mortgageWay;
    }

    /**
     * 按揭方式
     * @param mortgageWay 按揭方式
     */
    public void setMortgageWay(String mortgageWay) {
        this.mortgageWay = mortgageWay == null ? null : mortgageWay.trim();
    }

    /**
     * 按揭金额
     * @return mortgage_amount 按揭金额
     */
    public Double getMortgageAmount() {
        return (null != mortgageAmount ? mortgageAmount/1000000 : null);
    }

    /**
     * 按揭金额
     * @param mortgageAmount 按揭金额
     */
    public void setMortgageAmount(Double mortgageAmount) {
        this.mortgageAmount = (null != mortgageAmount ? mortgageAmount*1000000 : null);
    }

    /**
     * 按揭开始时间
     * @return mortgage_time 按揭开始时间
     */
    public Date getMortgageTime() {
        return mortgageTime;
    }

    /**
     * 按揭开始时间
     * @param mortgageTime 按揭开始时间
     */
    public void setMortgageTime(Date mortgageTime) {
        this.mortgageTime = mortgageTime;
    }

    /**
     * 月供
     * @return month_pay 月供
     */
    public Double getMonthPay() {
        return (null != monthPay ? monthPay/100 : null);
    }

    /**
     * 月供
     * @param monthPay 月供
     */
    public void setMonthPay(Double monthPay) {
        this.monthPay = (null != monthPay ? monthPay*100 : null);
    }

    /**
     * 按揭年限
     * @return mortgage_years 按揭年限
     */
    public Integer getMortgageYears() {
        return mortgageYears;
    }

    /**
     * 按揭年限
     * @param mortgageYears 按揭年限
     */
    public void setMortgageYears(Integer mortgageYears) {
        this.mortgageYears = mortgageYears;
    }

    /**
     * 车辆保险
     * @return vehicle_insurance 车辆保险
     */
    public String getVehicleInsurance() {
        return vehicleInsurance;
    }

    /**
     * 车辆保险
     * @param vehicleInsurance 车辆保险
     */
    public void setVehicleInsurance(String vehicleInsurance) {
        this.vehicleInsurance = vehicleInsurance == null ? null : vehicleInsurance.trim();
    }

    /**
     * 保险公司
     * @return insurance_company 保险公司
     */
    public String getInsuranceCompany() {
        return insuranceCompany;
    }

    /**
     * 保险公司
     * @param insuranceCompany 保险公司
     */
    public void setInsuranceCompany(String insuranceCompany) {
        this.insuranceCompany = insuranceCompany == null ? null : insuranceCompany.trim();
    }

    /**
     * 保险金额
     * @return insurance_amount 保险金额
     */
    public Double getInsuranceAmount() {
        return (null != insuranceAmount ? insuranceAmount/100 : null);
    }

    /**
     * 保险金额
     * @param insuranceAmount 保险金额
     */
    public void setInsuranceAmount(Double insuranceAmount) {
        this.insuranceAmount = (null != insuranceAmount ? insuranceAmount*100 : null);
    }

    /**
     * 扩展字段1
     * @return ext1 扩展字段1
     */
    public String getExt1() {
        return ext1;
    }

    /**
     * 扩展字段1
     * @param ext1 扩展字段1
     */
    public void setExt1(String ext1) {
        this.ext1 = ext1 == null ? null : ext1.trim();
    }

    /**
     * 扩展字段2
     * @return ext2 扩展字段2
     */
    public String getExt2() {
        return ext2;
    }

    /**
     * 扩展字段2
     * @param ext2 扩展字段2
     */
    public void setExt2(String ext2) {
        this.ext2 = ext2 == null ? null : ext2.trim();
    }

    /**
     * 扩展字段3
     * @return ext3 扩展字段3
     */
    public String getExt3() {
        return ext3;
    }

    /**
     * 扩展字段3
     * @param ext3 扩展字段3
     */
    public void setExt3(String ext3) {
        this.ext3 = ext3 == null ? null : ext3.trim();
    }

    /**
     * 扩展字段4
     * @return ext4 扩展字段4
     */
    public String getExt4() {
        return ext4;
    }

    /**
     * 扩展字段4
     * @param ext4 扩展字段4
     */
    public void setExt4(String ext4) {
        this.ext4 = ext4 == null ? null : ext4.trim();
    }

    /**
     * 扩展字段5
     * @return ext5 扩展字段5
     */
    public String getExt5() {
        return ext5;
    }

    /**
     * 扩展字段5
     * @param ext5 扩展字段5
     */
    public void setExt5(String ext5) {
        this.ext5 = ext5 == null ? null : ext5.trim();
    }

    /**
     * 扩展字段6
     * @return ext6 扩展字段6
     */
    public String getExt6() {
        return ext6;
    }

    /**
     * 扩展字段6
     * @param ext6 扩展字段6
     */
    public void setExt6(String ext6) {
        this.ext6 = ext6 == null ? null : ext6.trim();
    }

    /**
     * 扩展字段7
     * @return ext7 扩展字段7
     */
    public String getExt7() {
        return ext7;
    }

    /**
     * 扩展字段7
     * @param ext7 扩展字段7
     */
    public void setExt7(String ext7) {
        this.ext7 = ext7 == null ? null : ext7.trim();
    }

    /**
     * 扩展字段8
     * @return ext8 扩展字段8
     */
    public String getExt8() {
        return ext8;
    }

    /**
     * 扩展字段8
     * @param ext8 扩展字段8
     */
    public void setExt8(String ext8) {
        this.ext8 = ext8 == null ? null : ext8.trim();
    }

    /**
     * 扩展字段9
     * @return ext9 扩展字段9
     */
    public String getExt9() {
        return ext9;
    }

    /**
     * 扩展字段9
     * @param ext9 扩展字段9
     */
    public void setExt9(String ext9) {
        this.ext9 = ext9 == null ? null : ext9.trim();
    }

    /**
     * 扩展字段10
     * @return ext10 扩展字段10
     */
    public String getExt10() {
        return ext10;
    }

    /**
     * 扩展字段10
     * @param ext10 扩展字段10
     */
    public void setExt10(String ext10) {
        this.ext10 = ext10 == null ? null : ext10.trim();
    }

    /**
     * 扩展字段11
     * @return ext11 扩展字段11
     */
    public String getExt11() {
        return ext11;
    }

    /**
     * 扩展字段11
     * @param ext11 扩展字段11
     */
    public void setExt11(String ext11) {
        this.ext11 = ext11 == null ? null : ext11.trim();
    }

    /**
     * 扩展字段12
     * @return ext12 扩展字段12
     */
    public String getExt12() {
        return ext12;
    }

    /**
     * 扩展字段12
     * @param ext12 扩展字段12
     */
    public void setExt12(String ext12) {
        this.ext12 = ext12 == null ? null : ext12.trim();
    }

    /**
     * 扩展字段13
     * @return ext13 扩展字段13
     */
    public String getExt13() {
        return ext13;
    }

    /**
     * 扩展字段13
     * @param ext13 扩展字段13
     */
    public void setExt13(String ext13) {
        this.ext13 = ext13 == null ? null : ext13.trim();
    }

    /**
     * 扩展字段14
     * @return ext14 扩展字段14
     */
    public String getExt14() {
        return ext14;
    }

    /**
     * 扩展字段14
     * @param ext14 扩展字段14
     */
    public void setExt14(String ext14) {
        this.ext14 = ext14 == null ? null : ext14.trim();
    }

    /**
     * 扩展字段15
     * @return ext15 扩展字段15
     */
    public String getExt15() {
        return ext15;
    }

    /**
     * 扩展字段15
     * @param ext15 扩展字段15
     */
    public void setExt15(String ext15) {
        this.ext15 = ext15 == null ? null : ext15.trim();
    }

    public void setFrontShow(String frontShow) {
        this.frontShow = frontShow;
    }

    public String getPayTypeShow() {
        if(null != payType){
            return 1 == payType ? "全款车;" : "按揭车;";
        }else {
            return "";
        }
    }

    public void setPayTypeShow(String payTypeShow) {
        this.payTypeShow = payTypeShow;
    }

    public String getVehicleBrandShow() {
        return StringUtils.isNotEmpty(vehicleBrand) ? "车辆品牌【" + vehicleBrand + "】;" : "";
    }

    public void setVehicleBrandShow(String vehicleBrandShow) {
        this.vehicleBrandShow = vehicleBrandShow;
    }

    public String getBuyingTimeShow() {
        return (null != buyingTime ? "购买时间【" + DateUtil.dateToString(buyingTime, "yyyy-MM-dd") + "】;" : "");
    }

    public void setBuyingTimeShow(String buyingTimeShow) {
        this.buyingTimeShow = buyingTimeShow;
    }

    public String getBareCarPriceShow() {
        return (null != getBareCarPrice() ? "裸车价【" + getBareCarPrice() + "万】;" : "");
    }

    public void setBareCarPriceShow(String bareCarPriceShow) {
        this.bareCarPriceShow = bareCarPriceShow;
    }

    public String getKilometerShow() {
        return (null != kilometer ? "公里数【" + kilometer + "万公里】;" : "");
    }

    public void setKilometerShow(String kilometerShow) {
        this.kilometerShow = kilometerShow;
    }

    public String getVehicleTypeShow() {
        return (StringUtils.isNotEmpty(vehicleType) ? "车辆所属类型【" + vehicleType + "】;" : "");
    }

    public void setVehicleTypeShow(String vehicleTypeShow) {
        this.vehicleTypeShow = vehicleTypeShow;
    }

    public String getIsMortgageShow() {
        if(null != isMortgage){
            return 1 == isMortgage ? "是否被抵押【是】;" : "是否被抵押【否】;";
        }else {
            return "";
        }
    }

    public void setIsMortgageShow(String isMortgageShow) {
        this.isMortgageShow = isMortgageShow;
    }

    public String getVehicleAreaShow() {
        return (StringUtils.isNotEmpty(vehicleArea) ? "车辆地域【" + vehicleArea + "】;" : "");
    }

    public void setVehicleAreaShow(String vehicleAreaShow) {
        this.vehicleAreaShow = vehicleAreaShow;
    }

    public String getMortgageWayShow() {
        return StringUtils.isNotEmpty(mortgageWay) ? "按揭方式【" + mortgageWay + "】;" : "";
    }

    public void setMortgageWayShow(String mortgageWayShow) {
        this.mortgageWayShow = mortgageWayShow;
    }

    public String getMortgageAmountShow() {
        return null != getMortgageAmount() ? "按揭金额【" + getMortgageAmount() + "万】;" : "";
    }

    public void setMortgageAmountShow(String mortgageAmountShow) {
        this.mortgageAmountShow = mortgageAmountShow;
    }

    public String getMortgageTimeShow() {
        return null != mortgageTime ? "按揭开始时间【" + DateUtil.dateToString(mortgageTime, "yyyy-MM-dd") + "】;" : "";
    }

    public void setMortgageTimeShow(String mortgageTimeShow) {
        this.mortgageTimeShow = mortgageTimeShow;
    }

    public String getMonthPayShow() {
        return null != getMonthPay() ? "月供【" + getMonthPay() + "元】;" : "";
    }

    public void setMonthPayShow(String monthPayShow) {
        this.monthPayShow = monthPayShow;
    }

    public String getMortgageYearsShow() {
        return null != mortgageYears ? "按揭年限【" + mortgageYears + "年】;" : "";
    }

    public void setMortgageYearsShow(String mortgageYearsShow) {
        this.mortgageYearsShow = mortgageYearsShow;
    }

    public String getVehicleInsuranceShow() {
        return (StringUtils.isNotEmpty(vehicleInsurance) ? "车辆保险【" + vehicleInsurance +"】;" : "");
    }

    public void setVehicleInsuranceShow(String vehicleInsuranceShow) {
        this.vehicleInsuranceShow = vehicleInsuranceShow;
    }

    public String getInsuranceCompanyShow() {
        return (StringUtils.isNotEmpty(insuranceCompany) ? "保险公司【" + insuranceCompany +"】;" : "");
    }

    public void setInsuranceCompanyShow(String insuranceCompanyShow) {
        this.insuranceCompanyShow = insuranceCompanyShow;
    }

    public String getInsuranceAmountShow() {
        return null != insuranceAmount ? "保险金额【" + insuranceAmount + "元】;" : "";
    }

    public void setInsuranceAmountShow(String insuranceAmountShow) {
        this.insuranceAmountShow = insuranceAmountShow;
    }

    public String getFrontShow() {
        if(null != payType){
            if(payType == 1) {//全款
//                return getPayTypeShow() +getVehicleBrandShow() + getBuyingTimeShow() + getBareCarPriceShow() + getKilometerShow() +
//                        getVehicleTypeShow() + getIsMortgageShow() + getVehicleAreaShow();
                return getPayTypeShow() +getVehicleBrandShow() + getBuyingTimeShow() + getBareCarPriceShow() +
                        getVehicleTypeShow() + getIsMortgageShow() + getVehicleAreaShow();
            }else if(payType == 2){//按揭
//                return getPayTypeShow() + getVehicleBrandShow() + getBuyingTimeShow() + getBareCarPriceShow() + getKilometerShow() +
//                        getVehicleTypeShow() + getIsMortgageShow() + getVehicleAreaShow() + getMortgageWayShow() + getMortgageAmountShow() +
//                        getMortgageTimeShow() + getMonthPayShow() + getMortgageYearsShow() + getVehicleInsuranceShow() + getInsuranceCompanyShow() +
//                        getInsuranceAmountShow();
                return getPayTypeShow() + getVehicleBrandShow() + getBuyingTimeShow() + getBareCarPriceShow() +
                        getVehicleTypeShow() + getIsMortgageShow() + getVehicleAreaShow() + getMortgageWayShow() + getMortgageAmountShow() +
                        getMortgageTimeShow() + getMonthPayShow() + getMortgageYearsShow() + getVehicleInsuranceShow() + getInsuranceCompanyShow() +
                        getInsuranceAmountShow();
            }else{
                return  "";
            }
        }else {
            return  "";
        }
    }
}